package kr.co.boogui.actions.admin.movie;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kr.co.boogui.actions.ActionHandler;
import kr.co.boogui.service.AdminChkService;
import kr.co.boogui.service.CinemaRegistryService;

public class RegistryCinemaAction implements ActionHandler {
	@Override
	public String execute(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		
		String viewPage = "f|/WEB-INF/jsp/admin/admin.jsp";
		String method = req.getMethod();
		if (method.equalsIgnoreCase("get")){
			viewPage = AdminChkService.adminChk(req, "cinema_registry");
		} else if (method.equalsIgnoreCase("post")) {		
			req.setAttribute("action", "cinema_registry.jsp");
			req.setAttribute("regi", "y");
			if (CinemaRegistryService.cinemaRegistry(req)){
				req.setAttribute("isregi", "success");
			} else {
				req.setAttribute("isregi", "fail");
			}
				
		}		
		return viewPage;
	}
}
